<template>
  <router-link :to="`/category/sub/${cate.id}`"
               class="category">
    <img :src="cate.picture"/>
    <p>{{ cate.name }}</p>
  </router-link>
</template>

<script lang="ts"
        setup>
import type {Category} from '@/types/category'
import {toRefs} from 'vue'

let props = defineProps<{
  data: Category
}>()
let {data: cate} = toRefs(props)
</script>

<style lang="less"
       scoped>
.category {
  width: 168px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;

  &:hover {
    color: @xtxColor;
  }

  img {
    width: 100px;
    height: 100px;
  }

  p {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    font-size: 16px;
  }
}
</style>